﻿@model XPressify.Models.ImageGalleryModel
@using System.Web.Script.Serialization
@using XPressify.Data.Helpers
@using Omu.Awesome.Core;
@using Omu.Awesome.Mvc.Helpers;

@{
    ViewBag.Title = "Pictures";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript">
    $(document).ready(function () {
        $("#maincol").css('width', '750px');
    });
</script>

<h2 style="color:#222">
    @Model.SubjectName's photos - 
    @if(Model.Album.IsWall)
    {
        @:Wall photos
    }
    else if(Model.Album.IsProfile)
    {
        @:Profile photos
    }
    else
    {
        @Model.Album.Name
    }
</h2>

@Html.ActionLink("Back to album", "AlbumDetails", "Album", new { id = Model.AlbumId}, new { })
*
@Html.ActionLink(Model.SubjectName + "\'s albums", "AlbumViewerList", "Album", new { id = Model.SubjectId }, new { })
*
@if (Model.SubjectType == SubjectType.Event)
{
    @Html.ActionLink(Model.SubjectName , "EventDetails", "Event", new { id = Model.SubjectId}, new { })
}
else if (Model.SubjectType == SubjectType.Group)
{
    @Html.ActionLink(Model.SubjectName, "GroupDetails", "Group", new { id = Model.SubjectId }, new { })
}
else if (Model.SubjectType == SubjectType.Page)
{
    @Html.ActionLink(Model.SubjectName, "PageDetails", "Page", new { id = Model.SubjectId }, new { })
}
else if (Model.SubjectType == SubjectType.User)
{
    @Html.ActionLink(Model.SubjectName, "ProfileView", "Profile", new { id = Model.SubjectId }, new { })
}
<br /> <br />

@Html.Confirm("Are you sure you want to delete this post?", "myconfirmBtn", title: "Delete post", yesText: "Delete")
@Html.Confirm("Are you sure you want to delete this comment?", "myconfirmBtn1", title: "Delete comment", yesText: "Delete")

<div id="specialPeopleLikeList" style="display:none"></div> @*for PeopleLikeListPopup window*@
<div id="returnSuccessDelete"></div>

<div id="gallery">

    @foreach (var image in Model.Images)
    {
        <img src="@image.PicturePath" alt="@image.Description" />
    }
    
</div>

<div id="myCommentSection" style="margin:0% 9.7%"></div>

  <script type="text/javascript">
      $("#gallery").galleria({
          width: 750,
          height: 540,
          imageCrop: false,
          show: "@Model.IndexImage",
          clicknext : true
      });
      Galleria.get(0).bind("image", function (e) {
          var currentImage = Galleria.get(0).getActiveImage();
          resultHTML = jQuery.ajax({
              type: 'GET',
              url: '/Album/CommentsList/',
              data: 'path=' + currentImage.src,
              success: function (data) {
                  $('#myCommentSection').html(data);
              }
          }).responseText;
      });

      Galleria.get(0).attachKeyboard({
          left: Galleria.get(0).prev, // applies the native prev() function
          right: Galleria.get(0).next
      });

    </script>
